package sebastiankerckhof.structure;

import java.util.ArrayList;
import java.util.List;

import sebastiankerckhof.structure.math.Point3f;
import sebastiankerckhof.structure.math.Vector3f;


public class Vertex{
	public Point3f position;
	public Vector3f normal;
	public TexCoord2f texture;
	public Edge e;
	public Triangle t;
	
	public Vertex(Point3f position){
		this.position = position;
	}
	
	public Triangle[] getTriangles(){
		Triangle t = this.e.t;
		int i = this.e.i;
		List<Triangle> triangles = new ArrayList<Triangle>();
		triangles.add(t);
		
		do{
			t = t.nbr[i].t;
			i = t.nbr[i].i;
			triangles.add(t);
		}while(this.t != t);
		
		return (Triangle[]) triangles.toArray();
		
	}
}
